package uit.edu.vn.Activity;


import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.Toast;

public class BackupActivity extends Activity {

	///=============
	public Context context;
	public String listArrayBackup[]={"Sao Lưu Tập Tin ","Sao Lưu Danh Bạ ","Sao Lưu Tin Nhắn "};
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.backup);
		
		context=getBaseContext();
		ListView lv_Backup = (ListView)findViewById(R.id.backuplist);
		lv_Backup.setTextFilterEnabled(true);
		lv_Backup.setAdapter(new ArrayAdapter<String>(context,R.layout.row_infomain,R.id.txt_text,listArrayBackup));
		
		lv_Backup.setOnItemClickListener(new OnItemClickListener() 
		{
			@Override
			public void onItemClick(AdapterView<?> arg0, View arg1, int position,
					long arg3) {
				// TODO Auto-generated method stub
				// xu ly goi fileview ,contact view ,smsview 
				Intent i ;
				
				if(position==0)
				{
					//ShowToast(String.valueOf(position) );
					// goi fileviewActivity
					i= new Intent().setClass(context, FileBackupActivity.class);
					startActivity(i);
				
				}
				else if(position==1)
				{
					//goi contact view
					i= new Intent().setClass(context, ContactBackupActivity.class);
					startActivity(i);
				}
				else  
				{
					//Goi smsview
					i= new Intent().setClass(context, SMSBackupActivity.class);
					startActivity(i);
				}	
			
			}
		});
	}
	public void ShowToast(String message)
	{
		Toast.makeText(this, message, Toast.LENGTH_SHORT).show();
	}

}
